package com.shilun.springboot.hello_demo.init;

import org.springframework.boot.context.event.ApplicationReadyEvent;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Component;

@Component
public class ApplicationStartup implements ApplicationListener<ApplicationReadyEvent> {

	@Override
	public void onApplicationEvent(ApplicationReadyEvent event) {
		ApplicationContext applicationContext = event.getApplicationContext();
		System.out.println("项目已经启动,可以执行初始化任务");
	}

}
